package core.util;

import java.io.IOException;
import java.io.Reader;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

/**
 * @author songduk park
 * 
 */
public class IBATISFactory {

	SqlSessionFactory factory;

	public SqlSessionFactory getFactory() {
		return factory;
	}

	public IBATISFactory() {
		System.out.println(" new ... IBASTISFactory");
		make();
	}

	public void make() {
		try {
			Reader reader = Resources.getResourceAsReader("sqlmap-config.xml");
			factory = new SqlSessionFactoryBuilder().build(reader);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
